package com.neusoft.elmboot.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.elmboot.po.Food;
import com.neusoft.elmboot.service.FoodService;


@RestController
@RequestMapping("/Food")
public class FoodController {
	
	@Autowired
	private FoodService foodService;

	@RequestMapping(value = "/businessId/{businessId}", method = RequestMethod.GET)
	public List<Food> listFoodByBusinessId(@PathVariable("businessId") Integer businessId) throws Exception{
		return foodService.listFoodByBusinessId(businessId);
	}

	@RequestMapping(value = "/foodId/{foodId}/foodPrice/{foodPrice}", method=RequestMethod.GET)
	public int updateFood(
		@PathVariable("foodId") Integer foodId,
		@PathVariable("foodPrice") Double foodPrice
		) {
		return foodService.updateFood(foodId, foodPrice);
	}
	
}
